;!function(){

var conf = {
    ie6: !-[1,] && !window.XMLHttpRequest,
    win: $(window),
    anode: $('.layer_first>a'),  
    //获取host
    hosts: 'http://' + location.host + '/'
};

//tab
conf.tabs = function(nodes, now, main, event){
    var set, hashs = {
        api: {
            '#base': 0,
            '#method': 1,
            '#ext': 2
        }
    };
    
    //通过hash定位api
    if(location.hash){
        var index = hashs.api[location.hash];
        nodes.eq(index).addClass(now).siblings().removeClass(now);
        $(main).eq(index).show().siblings(main).hide();
    }
    
    nodes[event || 'hover'](function(){
        var othis = $(this), hash = othis.attr('hash');
        clearTimeout(set);
        set = setTimeout(function(){
            var index = othis.index();
            othis.addClass(now).siblings().removeClass(now);
            $(main).eq(index).show().siblings(main).hide();
            if(hash){
                location.hash = hash;
            }
        }, event ? 0 : 300);
    });
    
    event || nodes.mouseleave(function(){
        clearTimeout(set);
    });
};

//事件
conf.event = function(){       
    conf.tabs($('.layer_apiTitle>li'),'apinow','.layer_apiBox', 'click');
    $('.navlist>li').on('click', function(){
        var othis = $(this);
        othis.addClass('thisnavlist').siblings().removeClass('thisnavlist');
    });        
};

//初始即执行
conf.start = (function(){     
    conf.event();    
}());

}();